package com.example.mybatisplus.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.mybatisplus.model.domain.Buildings;
import com.example.mybatisplus.mapper.BuildingsMapper;
import com.example.mybatisplus.model.dto.PageDTO;
import com.example.mybatisplus.model.dto.vo.Id_BuildingVO;
import com.example.mybatisplus.model.dto.vo.Stats4BuildingVO;
import com.example.mybatisplus.service.BuildingsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lxp
 * @since 2024-07-16
 */
@Service
public class BuildingsServiceImpl extends ServiceImpl<BuildingsMapper, Buildings> implements BuildingsService {

    @Override
    public List<Stats4BuildingVO> getBuildingById() {
        return baseMapper.getBuildingById();
    }

    @Override
    public Page<Buildings> pageList(Buildings buildings, PageDTO dto) {
        QueryWrapper<Buildings> wrapper = new QueryWrapper<>();
        Page<Buildings> page = new Page<>();
        page.setCurrent(dto.getPageNo()).setSize(dto.getPagesize());
        baseMapper.selectPage(page,wrapper);
        return page;
    }

    @Override
    public List<Id_BuildingVO> buildingListById(int id) {
        return baseMapper.buildingListById(id);
    }
}
